﻿<Window x:Class="LFSRecord2.View.Dialogs.ProjectConfigurationDialogBox"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:lfsvval="clr-namespace:LFSRecord2.View.Validators"
        Title="Project Settings" Height="300" Width="320"
        ShowInTaskbar="False" Background="#FFF5ECEC"
        WindowStartupLocation="CenterOwner" Loaded="Window_Loaded" ResizeMode="NoResize">
    <Window.Resources>
        <BitmapImage x:Key="AlertIcon" UriSource="pack://application:,,,/data/bitmaps/icons/Alert.gif" />
    </Window.Resources>
    <Grid>
        <Grid.Resources>
            <Style TargetType="{x:Type Label}">
                <Setter Property="Margin" Value="0,3,5,5" />
                <Setter Property="Padding" Value="0,0,0,5" />
            </Style>
            <Style TargetType="{x:Type TextBox}">
                <Setter Property="Margin" Value="0,0,0,5" />
                <Setter Property="Background" Value="#FFFAFAFA" />
                <Setter Property="BorderBrush" Value="#FF8D8D8D" />
            </Style>
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="34" />
        </Grid.RowDefinitions>
        <TabControl Margin="2,2,2,0" BorderThickness="2" BorderBrush="#FF8D8D8D" Background="#FFF5ECEC">
            <TabItem Header="Main">
                <Grid Margin="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100*" />
                        <ColumnDefinition Width="178*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Label Grid.Column="0" Grid.Row="0">Project Name :</Label>
                    <TextBox Name="projectNameTextBox" Grid.Column="1" Grid.Row="0" MaxLength="22" Text="{Binding ProjectName}" />

                    <Label Grid.Column="0" Grid.Row="1">Project Length :</Label>
                    <TextBox Name="projectLengthTextBox" Grid.Column="1" Grid.Row="1" Margin="0,0,114,5">
                        <TextBox.Text>
                            <Binding Path="ProjectLength" UpdateSourceTrigger="PropertyChanged">
                                <Binding.ValidationRules>
                                    <lfsvval:ProjectLengthValidationRule MinLength="1" MaxLength="300" />
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <Label Grid.Column="1" Grid.Row="1" Margin="75,3,0,5" Width="103">seconds</Label>

                    <Label Grid.Column="0" Grid.Row="2">FPS :</Label>
                    <TextBox Name="projectFPSTextBox" Grid.Column="1" Grid.Row="2" Margin="0,0,114,5" TextChanged="projectFPSTextBox_TextChanged">
                        <TextBox.Text>
                            <Binding Path="FPS" UpdateSourceTrigger="PropertyChanged">
                                <Binding.ValidationRules>
                                    <lfsvval:ProjectFpsValidationRule MinFps="1" MaxFps="100" />
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <Label Grid.Column="1" Grid.Row="2" Margin="75,3,0,5" Width="103">frames per second</Label>

                    <Grid Name="FPSWarningLabel" Grid.ColumnSpan="2" Grid.Row="3" Visibility="Collapsed">
                        <Image Source="{StaticResource AlertIcon}" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock TextWrapping="Wrap" FontSize="10" Margin="17,0,0,0">
                            Warning : if you record from a replay at the given FPS, cars will not be smooth. You can only get smooth car movement using 100, 50, 25, 20, 10, 5, 4, 2 or 1 FPS.
                        </TextBlock>
                    </Grid>
                    <Grid Name="FPSWarningLabel2" Grid.ColumnSpan="2" Grid.Row="3" Visibility="Collapsed">
                        <Image Source="{StaticResource AlertIcon}" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock TextWrapping="Wrap" FontSize="10" Margin="17,0,0,0">
                            Warning : After Effects export is not possible at 100 FPS.
                        </TextBlock>
                    </Grid>

                    <Label Grid.Column="0" Grid.Row="4" ToolTip="Inverts the mouse axes while adjusting the view in 3D view-mode.">Invert Axes :</Label>
                    <CheckBox Name="projectMove3DAxesInvert" 
                              Margin="2,5,0,0"
                              Grid.Column="1" Grid.Row="4" 
                              IsChecked="{Binding Move3DAxesInvert}" 
                              HorizontalAlignment="Left" VerticalAlignment="Top" 
                              ToolTip="Inverts the mouse axes while adjusting the view in 3D view-mode." />
                </Grid>

            </TabItem>
            <TabItem Header="InSim">
                <Grid Margin="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Label Grid.Column="0" Grid.Row="0">InSim IP :</Label>
                    <TextBox Name="insimIPTextBox" Grid.Column="1" Grid.Row="0" MaxLength="15" Text="{Binding InSimIP}" />

                    <Label Grid.Column="0" Grid.Row="1">InSim Port :</Label>
                    <TextBox Name="insimPortTextBox" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Width="75">
                        <TextBox.Text>
                            <Binding Path="InSimPort" UpdateSourceTrigger="PropertyChanged">
                                <Binding.ValidationRules>
                                    <lfsvval:InSimPortValidationRule MinPort="1024" MaxPort="65535" />
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>

                    <Label Grid.Column="0" Grid.Row="2">InSim Pass :</Label>
                    <TextBox Name="insimAdminPasswordTextBox" Grid.Column="1" Grid.Row="2" MaxLength="15" Text="{Binding InSimAdminPassword}" />
                </Grid>
            </TabItem>
            <TabItem Header="Recording">
                <Grid Margin="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="115" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Label Grid.Column="0" Grid.Row="0" ToolTip="When enabled, LFSRecord will automatically switch LFS to full screen mode when recording.">Capture Full Screen :</Label>
                    <CheckBox Name="projectRecordFullScreenOverride" 
                              Margin="2,5,0,0"
                              Grid.Column="1" Grid.Row="0" 
                              IsChecked="{Binding RecordFullScreenOverride}" 
                              HorizontalAlignment="Left" VerticalAlignment="Top" 
                              ToolTip="When enabled, LFSRecord will automatically switch LFS to full screen mode when recording." />

                    <Label Grid.Row="1" ToolTip="This is the screen resolution that full screen mode will use. In other words, this sets the dimension of your movie clip.">F.S. Screen Size :</Label>
                    <ComboBox Margin="0,0,20,6" 
                              Grid.Column="1" Grid.Row="1" 
                              Name="ScreenResolutionComboBox" 
                              IsEnabled="{Binding ElementName=projectRecordFullScreenOverride, Path=IsChecked}" 
                              SelectionChanged="ScreenResolutionComboBox_SelectionChanged"/>

                    <Label Grid.Column="0" Grid.Row="2" ToolTip="When recording full screen, use this hotkey to stop recording, exit full screen mode and return to LFSRecord.">Exit F.S. Hotkey :</Label>
                    <TextBox Name="projectRecordStopHotkey"
                             Grid.Column="1" Grid.Row="2"
                             Width="75" 
                             IsEnabled="{Binding ElementName=projectRecordFullScreenOverride, Path=IsChecked}" 
                             HorizontalAlignment="Left" VerticalAlignment="Top"
                             PreviewKeyDown="projectRecordStopHotkey_PreviewKeyDown" />

                    <Label Grid.Column="0" Grid.Row="3" ToolTip="When enabled, LFSRecord will automatically hide the 2D HUD display when recording.">Hide 2D Display :</Label>
                    <CheckBox Name="projectRecordHide2D" 
                              Margin="2,5,0,0"
                              Grid.Column="1" Grid.Row="3" 
                              IsChecked="{Binding RecordHide2D}" 
                              HorizontalAlignment="Left" VerticalAlignment="Top" 
                              ToolTip="When enabled, LFSRecord will automatically hide the 2D HUD display when recording." />
                </Grid>
            </TabItem>
            <TabItem Header="Sound">
                <Grid Margin="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="115" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Label Grid.Row="0" ToolTip="Select the sound device to use for playback">Playback device :</Label>
                    <ComboBox Margin="0,0,10,6" 
                              Grid.Column="1" Grid.Row="0" 
                              Name="SoundDeviceComboBox"  
                              SelectionChanged="SoundDeviceComboBox_SelectionChanged"/>

                    <Label Grid.Row="1" ToolTip="Select the samplerate">Sample rate :</Label>
                    <ComboBox Margin="0,0,70,6" 
                              Grid.Column="1" Grid.Row="1" 
                              Name="SampleRateComboBox"  
                              SelectionChanged="SampleRateComboBox_SelectionChanged"/>
                </Grid>
            </TabItem>
        </TabControl>

        <Border Grid.Row="1" Margin="2" Padding="2" BorderThickness="2" BorderBrush="#FF8D8D8D" VerticalAlignment="Bottom">
            <StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="6" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Name="okButton" Click="okButton_Click" IsDefault="True" Width="54" Margin="2,0,2,0">OK</Button>
                <Button Name="cancelButton" IsCancel="True" Width="54" Margin="2,0,2,0">Cancel</Button>
            </StackPanel>
        </Border>
    </Grid>
</Window>
